package neptune.manager.builder;

import neptune.manager.model.topology.IPAddress;

public class IPAddressBuilderTEST {

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {

		IPAddress address = new IPAddress(4, "192.168.0.254", "255.255.240.0");
		System.out.println(IPAddressBuilder.buildNextValidHostAddress(address));

		String mask =  "255.255.0.0";
		address = new IPAddress(4, "10.2.0.0",mask);
		IPAddress generated = subnetAddress(address, "255.255.255.0");
		System.out.println("Base:" + address.getSubnetAddress()
				+ "\nGenerated:"
				+ generated.getSubnetAddress()
				+ "\n2nd Generated:"
				+ IPAddressBuilder.getNextSubnet(generated.getSubnetAddress()));

	}

	private static IPAddress subnetAddress(IPAddress base, String subnet)
			throws Exception {
		IPAddress address = new IPAddress(4, base.getAddress(), subnet);
		return address;
	}

}
